import request from '@/utils/request'

//  查询专题检查列表
export function getDefectInspectList(params) {
  return request({
    url: '/business/defect/ztDefectInspect/list',
    method: 'get',
    params
  })
}

//  获取专题检查详情
export function getDefectInspectInfoById(id) {
  return request({
    url: `/business/defect/ztDefectInspect/${id}`,
    method: 'get',
  })
}

//  启动专题检查
export function startDefectInspect(params) {
  return request({
    url: '/business/defect/ztDefectInspect/startZtInspect',
    method: 'get',
    params
  })
}

//  新增专题检查草稿
export function addDefectInspect(data) {
  return request({
    url: '/business/defect/ztDefectInspect/add',
    method: 'post',
    data
  })
}

//  创建专题检查并启动
export function createDefectInspect(data) {
  return request({
    url: '/business/defect/ztDefectInspect/addAndStart',
    method: 'post',
    data
  })
}

//  修改专题检查接口
export function updateDefectInspect(data) {
  return request({
    url: '/business/defect/ztDefectInspect/update',
    method: 'put',
    data
  })
}

//  修改专题检查并启动
export function updateAndStartDefectInspect(data) {
  return request({
    url: '/business/defect/ztDefectInspect/updateAndStart',
    method: 'put',
    data
  })
}

//  删除专题检查
export function delDefectInspect(ids) {
  return request({
    url: `/business/defect/ztDefectInspect/${ids}`,
    method: 'delete',
  })
}

//  追加下发目标
export function appendOrg(data) {
  return request({
    url: '/business/defect/ztDefectInspect/appendOrg',
    method: 'post',
    data
  })
}

//  查询检查的下级，也就是根节点
export function queryResponsibleTaskNodes(params) {
  return request({
    url: '/business/defect/ztDefectInspect/queryResponsibleTaskNodes',
    method: 'get',
    params
  })
}

//  查询节点的下级
export function queryChildTaskNodes(params) {
  return request({
    url: '/business/defect/ztDefectInspect/queryChildTaskNodes',
    method: 'get',
    params
  })
}

//  接受任务
export function acceptTask(data) {
  return request({
    url: '/business/defect/ztDefectInspect/acceptTask',
    method: 'post',
    data
  })
}

//  启动
export function startNode(data) {
  return request({
    url: '/business/defect/ztDefectInspect/startNode',
    method: 'post',
    data
  })
}
